<template>
  <div id="OrdersTitle">
    <v-details
      :inputConfig="inputConfig"
      :detailData="inputData"
      :rules="rules"
      ref="input"
    ></v-details>
  </div>
</template>

<script>
import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
  props: {
    inputData: {
      type: Object,
    }
  },
  mixins: [baseMixin],
  name: "OrdersTitle",
  data () {
    return {
      rules: {
        taskgroup: [
          { required: true, validator: this.taskgroup, trigger: 'blur' },
        ],
        username: [
          { required: true, validator: this.taskgroup, trigger: 'blur' },
        ]
      },
    }
  },
  computed: {
    inputConfig () {
      return [
        [
          {
            type: "input",
            label: this.$t('out.taskgroup'),
            props: "taskgroup",
          }
        ],
        [
          {
            type: "input",
            label: this.$t('outbound.user'),
            props: "username",
          }
        ]
      ]

    }
  },
  methods: {
    taskgroup (rule, value, callback) {
      let reg = /^\w+$/;//由数字、26个英文字母或者下划线组成的字符串
      if (value == '') {
        this.$message.error(this.$t('msg.msg27'));
        callback(new Error())
      } else {
        if (!reg.test(value)) {
          // this.inputData[rule.field] = ''
          this.$message.error(this.$t('msg.msg28'));
          callback(new Error())
        } else {
          callback()
        }
      }

    },

  },
  mounted () {

  },
  watch: {},
  components: {
    'v-details': details
  }
}
</script>

<style scoped>
</style>
